<!DOCTYPE html>
<html lang="en">

	<head>
		<meta charset="UTF-8">
		<title>Title</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<link rel="stylesheet" href="../../layui/css/layui.css" media="all">
	</head>

	<body>
		<fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
			<legend>FNST-在线笔试系统</legend>
		</fieldset>
		<div style="padding: 20px; background-color: #F2F2F2;">
			<div class="layui-row layui-col-space15">
				<div class="layui-col-md12">
					<div class="layui-card">
						<div class="layui-card-header">笔试者新增</div>

						<div class="layui-card-body">
							<div class="layui-form">
								<div class="layui-form-item">
									<label class="layui-form-label">笔试者：</label>
									<div class="layui-input-block">
										<input type="text" id="username" name="username" lay-verify="required" autocomplete="off" placeholder="请输入笔试者名" class="layui-input">
									</div>
								</div>

								<div class="site-demo-button" style="margin-top: 40px; ">
									<button class="layui-btn" lay-submit lay-filter="saveUser" id="saveUser">保存</button>
									<button class="layui-btn site-demo-layedit" style="float:right;" id="returnUserList">返回列表</button>

								</div>
							</div>

						</div>
					</div>
				</div>
			</div>
		</div>

		<script src="../../layui/layui.js"></script> 
		<script src="../js/common.js"></script>
		<script type="text/javascript" src="../../js/jquery.min.js"></script>
		<script>
			layui.config({
				base: './../dist/'
			}).extend({
				notice: 'notice'
			});
			layui.use(['notice', 'layer'], function() {
				var notice = layui.notice; // 允许别名 toastr
				var layer = layui.layer;
				$("#saveUser").click(function() {
					$.ajax({
						type: 'post',
						url: host()+'/addNewUser',
						data: {
							username: $("#username").val(),
							token: localStorage.getItem("token")
						},
						dataType: 'json',
						async: true,
						success: function(res) {
							notice.success(res.msg);
						},
						error: function(res) {
							notice.error(res.msg);
						}
					})
				})

				$("#returnUserList").click(function() {
					window.open("userList.html", "iframe")
				})
			})

		</script>
	</body>

</html>